<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>实例对象</title>
  <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
</head>
<body>
  <script>
    // 创建实例对象 
    const request = axios.create({
      baseURL: 'https://api.apiopen.top',
      timeout: 2000
    })
    // 这里的 request对象与axios对象的功能几近是一样的
    console.log(request)
    // request({
    //   url: '/getJoke'
    // }).then(response => {
    //   console.log(response)
    // })
    request.get('/getJoke').then(response => {
      console.log(response)
    })
  </script>
</body>
</html>